/* tslint:disable:no-console */

import {InterfaceUser} from '@/interface/InterfaceUser';
import {InterfaceBankCard as bankCardType} from '@/interface/InterfaceBankCard';
import {ActionContext, ActionTree, Commit, Dispatch, MutationTree} from 'vuex';
import * as types from '../mutation-types';


import '@/interface/InterfaceType';

export default class UserStore {

    public static initState: InterfaceUser = {
        Token: '',
        StudentList: [],
        UserData: {},
        UserId: 0,
        UserArgument: {},
    };
    public static state: InterfaceUser = UserStore.initState;


    public static mutations: MutationTree<InterfaceUser> = {
        [types.USER_UPDATE](state: InterfaceUser, user: InterfaceUser) {
            user.UserArgument = {
                stId: user.StudentList[0].st_Id,
                token: user.Token,
                userId: user.UserId,
            };
            state = Object.assign(state, user);
        },
        [types.USER_EXIT](state: InterfaceUser) {
            state = Object.assign(state, UserStore.initState);
        },
    };

    public static action: any = {};
}
